//
// Created by jsjxsy on 2022/8/15.
//友元函数
//
#include <string>
#include <iostream>
using namespace std;
class Building {
  friend class GoodGay;
 public:
  Building();
  ~Building();
  string bedRoom;
 private:
  string classRoom;
};

Building::Building() {
  bedRoom = "我的卧室";
  classRoom = "我的客厅";
}
Building::~Building() {

}

class GoodGay {
 public:
  GoodGay();
  ~GoodGay();
  Building *building;
  void visit();
};
GoodGay::GoodGay() {
  building = new Building();
}

void GoodGay::visit() {
  cout << building->bedRoom << endl;
  cout << building->classRoom << endl;
}

GoodGay::~GoodGay() {
  delete building;
}
int main(void) {
  GoodGay gay;
  gay.visit();
  return 0;
}

